/*
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in compliance with
 *  the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
 /**
 * @author Oleg V. Khaschansky
 */
 
/* DO NOT EDIT THIS FILE - it is based on GLX headers and was autogenerated by nativebridge tool */

#include "org_apache_harmony_awt_nativebridge_linux_GLX.h"

static libHandler libGL;
JNIEXPORT void JNICALL Java_org_apache_harmony_awt_nativebridge_linux_GLX_init (JNIEnv * env, jclass cls) {
    LOAD_LIB(libGL, GL);
}


int (* p_nbridge_glXQueryExtension) (void *, void *, void *) = NULL;

JNIEXPORT jint  JNICALL Java_org_apache_harmony_awt_nativebridge_linux_GLX_glXQueryExtension( JNIEnv *env, jobject self, jlong dpy, jlong error_base, jlong event_base) {
    if (p_nbridge_glXQueryExtension == NULL) {
        p_nbridge_glXQueryExtension = (int (*) (void *, void *, void *)) FindFunction(libGL, "glXQueryExtension");
    }
    return (jint) (* p_nbridge_glXQueryExtension)((void *)(size_t) dpy, (void *)(size_t)  error_base, (void *)(size_t)  event_base);
}

int (* p_nbridge_glXGetFBConfigAttrib) (void *, void *, int, void *) = NULL;

JNIEXPORT jint  JNICALL Java_org_apache_harmony_awt_nativebridge_linux_GLX_glXGetFBConfigAttrib( JNIEnv *env, jobject self, jlong dpy, jlong config, jint attribute, jlong value) {
    if (p_nbridge_glXGetFBConfigAttrib == NULL) {
        p_nbridge_glXGetFBConfigAttrib = (int (*) (void *, void *, int, void *)) FindFunction(libGL, "glXGetFBConfigAttrib");
    }
    return (jint) (* p_nbridge_glXGetFBConfigAttrib)((void *)(size_t)  dpy, (void *)(size_t)  config, (int) attribute, (void *)(size_t)  value);
}

void * (* p_nbridge_glXCreateNewContext) (void *, void *, int, void *, int) = NULL;

JNIEXPORT jlong  JNICALL Java_org_apache_harmony_awt_nativebridge_linux_GLX_glXCreateNewContext( JNIEnv *env, jobject self, jlong dpy, jlong config, jint render_type, jlong share_list, jint direct) {
    if (p_nbridge_glXCreateNewContext == NULL) {
        p_nbridge_glXCreateNewContext = (void * (*) (void *, void *, int, void *, int)) FindFunction(libGL, "glXCreateNewContext");
    }
    return (jlong)(size_t) (* p_nbridge_glXCreateNewContext)((void *)(size_t)  dpy, (void *)(size_t)  config, (int) render_type, (void *)(size_t)  share_list, (int) direct);
}

int (* p_nbridge_glXMakeCurrent) (void *, long, void *) = NULL;

JNIEXPORT jint  JNICALL Java_org_apache_harmony_awt_nativebridge_linux_GLX_glXMakeCurrent( JNIEnv *env, jobject self, jlong dpy, jlong drawable, jlong ctx) {
    if (p_nbridge_glXMakeCurrent == NULL) {
        p_nbridge_glXMakeCurrent = (int (*) (void *, long, void *)) FindFunction(libGL, "glXMakeCurrent");
    }
    return (jint) (* p_nbridge_glXMakeCurrent)((void *)(size_t)  dpy, (long) drawable, (void *)(size_t)  ctx);
}

void (* p_nbridge_glXDestroyContext) (void *, void *) = NULL;

JNIEXPORT void  JNICALL Java_org_apache_harmony_awt_nativebridge_linux_GLX_glXDestroyContext( JNIEnv *env, jobject self, jlong dpy, jlong ctx) {
    if (p_nbridge_glXDestroyContext == NULL) {
        p_nbridge_glXDestroyContext = (void (*) (void *, void *)) FindFunction(libGL, "glXDestroyContext");
    }
    (* p_nbridge_glXDestroyContext)((void *)(size_t)  dpy, (void *)(size_t)  ctx);
}

void (* p_nbridge_glXDestroyPbuffer) (void *, long) = NULL;

JNIEXPORT void  JNICALL Java_org_apache_harmony_awt_nativebridge_linux_GLX_glXDestroyPbuffer( JNIEnv *env, jobject self, jlong dpy, jlong pbuf) {
    if (p_nbridge_glXDestroyPbuffer == NULL) {
        p_nbridge_glXDestroyPbuffer = (void (*) (void *, long)) FindFunction(libGL, "glXDestroyPbuffer");
    }
    (* p_nbridge_glXDestroyPbuffer)((void *)(size_t) dpy, (long) pbuf);
}

void * (* p_nbridge_glXChooseFBConfig) (void *, int, void *, void *) = NULL;

JNIEXPORT jlong  JNICALL Java_org_apache_harmony_awt_nativebridge_linux_GLX_glXChooseFBConfig( JNIEnv *env, jobject self, jlong dpy, jint screen, jlong attrib_list, jlong nelements) {
    if (p_nbridge_glXChooseFBConfig == NULL) {
        p_nbridge_glXChooseFBConfig = (void * (*) (void *, int, void *, void *)) FindFunction(libGL, "glXChooseFBConfig");
    }
    return (jlong)(size_t) (* p_nbridge_glXChooseFBConfig)((void *)(size_t) dpy, (int) screen, (void *)(size_t) attrib_list, (void *)(size_t) nelements);
}

unsigned long  (* p_nbridge_glXCreatePbuffer) (void *, void *, void *) = NULL;

JNIEXPORT jlong  JNICALL Java_org_apache_harmony_awt_nativebridge_linux_GLX_glXCreatePbuffer( JNIEnv *env, jobject self, jlong dpy, jlong config, jlong attrib_list) {
    if (p_nbridge_glXCreatePbuffer == NULL) {
        p_nbridge_glXCreatePbuffer = (unsigned long  (*) (void *, void *, void *)) FindFunction(libGL, "glXCreatePbuffer");
    }
    return (jlong) (* p_nbridge_glXCreatePbuffer)((void *)(size_t) dpy, (void *)(size_t) config, (void *)(size_t) attrib_list);
}

void (* p_nbridge_glXSwapBuffers) (void *, long) = NULL;

JNIEXPORT void  JNICALL Java_org_apache_harmony_awt_nativebridge_linux_GLX_glXSwapBuffers( JNIEnv *env, jobject self, jlong dpy, jlong drawable) {
    if (p_nbridge_glXSwapBuffers == NULL) {
        p_nbridge_glXSwapBuffers = (void (*) (void *, long)) FindFunction(libGL, "glXSwapBuffers");
    }
    (* p_nbridge_glXSwapBuffers)((void *)(size_t) dpy, (long) drawable);
}

int (* p_nbridge_glXMakeContextCurrent) (void *, long, long, void *) = NULL;

JNIEXPORT jint  JNICALL Java_org_apache_harmony_awt_nativebridge_linux_GLX_glXMakeContextCurrent( JNIEnv *env, jobject self, jlong display, jlong draw, jlong read, jlong ctx) {
    if (p_nbridge_glXMakeContextCurrent == NULL) {
        p_nbridge_glXMakeContextCurrent = (int (*) (void *, long, long, void *)) FindFunction(libGL, "glXMakeContextCurrent");
    }
    return (jint) (* p_nbridge_glXMakeContextCurrent)((void *)(size_t) display, (long) draw, (long) read, (void *)(size_t) ctx);
}
